<?php

namespace api\controller;

use common\controller\VerifyController;
use common\service\DemandPoolReportService;
use think\Request;
use think\Response;

class DemandPoolReportController extends VerifyController
{
    private $reportService;

    public function __construct()
    {
        parent::__construct();
        $this->reportService = DemandPoolReportService::getInstance();
    }

    /**
     * 获得需求池统计列表
     * @param Request $request
     * @return Response
     */
    public function getDemandPoolList(Request $request)
    {
        $param = $request->param()['param'];
        //时间范围
        $time = [$param['start_time'], $param['end_time']];
        $attribute = $param['attribute'] ?? '';

        $res = $this->reportService->getDemandPoolList($param['project_id'], $param['step_category_id'], $time, $attribute);
        return json(success_response("OK", $res));
    }
}
